import { BasicPageParams } from '@/api/model/baseModel'
import { getOrderPaymentRecordList, getOrderPaymentStorePromoterList, setOrderPaymentAudit } from '@/api/union'

export interface PromoterListParams extends BasicPageParams {
  merchantId?: number //账户ID
  startDate?: string //开始时间
  endDate?: string //结束时间
  roleId?: number //版本
  accountId?: number //归属账号
  promoterStatus?: 0 | 1 | 2 //推客状态:0-冻结；1-启用
  promoterId?: string //推广员ID
  finderNickname?: string //视频号
  companyName?: string //推客主体
  organizationType?: 2 | 4 //主体：2-企业；4-个体工商户；
  principalName?: string //管理员
  serviceMobile?: string //客服电话
}

export interface PromoterListModel {
  id: number
  promoterId: string
  finderNickname: string
  createdAt: string
  promoterStatus: 0 | 1 | 2
  storeId: number
  storeName: string
  companyName: string
  principalName: string
  serviceMobile: string
  roleIdList: number[]
  roleNameList: string[]
  applymentState: string
  organizationType: number
  accountName: string
  accountId: number
  accountMobile: string
  bankAccountName: string
  bankBranchName: string
  accountNumber: string
  accountBank: string
}

export interface PromoterDetailParams {
  promoterId: string | number
}

export interface PromoterDetailModel {
  id: number
  promoterId: string
  finderNickname: string
  openId: string
  createdAt: string
  promoterStatus: number
  accountId: number
  storeId: number
  principalId: number
  principalName: string
  accountName: string
  accountMobile: string
  serviceMobile: string
  qualification: {
    id: number
    storeId: number
    organizationType: 2 | 4
    licenseUrl: string
    licenseSerial: string
    licenseMediaId: string
    companyName: string
    licenseStartDate: string
    licenseEndDate: string | null
    companyAddress: string
    additionPics: string
    additionDesc: string
    idcardCopyUrl: string
    idcardCopyId: string
    idcardNationalUrl: string
    idcardNationalId: string
    idcardName: string
    idcardNumber: string
    idcardStartDate: string
    idcardEndDate: string | null
    contactMobile: string
    contactEmail: string
    createdAt: string
    updatedAt: string
    applymentId: string
    outRequestNo: string
    applymentState: string
    subMchid: string
    auditDetail: string
    beneficiaryType: 0 | 1
    storeCardEntity: {
      id: number
      storeId: number
      bankAccountType: 74 | 75
      accountBank: string
      accountName: string
      bankProvince: string
      bankCity: string
      bankAddressCode: string
      accountNumber: string
      bankBranchId: string
      bankBranchName: string
      auditedBatch: string
    }
  }
}

export interface PromoterRoleUpdateParams {
  promoterId: string
  roleIdList: number[]
}

export interface PromoterFreezeParams {
  promoterId: string
}

export interface PromoterOwnerUpdateParams {
  promoterId: string
  accountId: number
}

export interface PromoterEnableParams {
  promoterId: string
}

export interface PromoterOpenParams {
  promoterId: string //推广员ID
  smsCode: string //短信验证码
  accountId: number //归属人ID
  merchantName: string //管理员
  merchantMobile: string //管理员客服手机号
}

export interface OrderPaymentListParams {
  time?: null | string[]
  paymentTime?: null | string[]
  keywordsType: string
  keywords?: null | string
  keyType: string
  keyValue?: null | string
  promoterId?: string
  finderNickname?: string
  startDate?: string
  endDate?: string
  paymentStatus?: null | number
  paymentStartDate?: string
  paymentEndDate?: string
}

export interface OrderPaymentListModel {
  id: number
  promoterId: string
  finderNickname: string
  promoterStatus: 1 | 2
  paymentStatus: 0 | 1 | 2
  createdAt: string
  paymentTime: string
  paymentAmount: number
}

export interface OrderPaymentRecordListParams {
  paymentId: number | string
}

export interface OrderPaymentRecordListModel {
  id: number
  finderNickname: string
  paymentStatus: 1 | 2
  createdAt: string
  voucherUrls: null | string[]
  paymentAmount: number
  creatorName: string
  creatorMobile: string
}

export interface OrderPaymentAuditParams {
  paymentId: number | string
  paymentStatus: 1 | 2
  voucherUrls: string[]
}
export interface OrderListParams {
  storeId?: number //店铺ID
  storeName?: string //店铺名称
  promoterId?: string //推客ID
  finderNickname?: string //推客视频号昵称
  paymentId?: number //推客结算记录ID
  orderNo?: string //订单编号
  payNo?: string //支付单号
  paymentStatus?: 0 | 1 | 2 | 3 //佣金状态：0-待结算；1-已结算；2-汇款失败；3-取消结算
  startDate?: string //下单开始时间
  endDate?: string //下单结束时间
}

export interface OrderListModel {
  id: string
  storeId: number
  storeName: string
  orderNo: string
  createdAt: string
  openId: string
  orderStatus: number
  productId: string
  productTitle: string
  productNum: string | number
  productImgUrl: string
  productSkuId: string | number
  productSku: string
  productCount: number
  productPrice: number
  totalPay: number
  payTime: string
  payNo: number
  expressType: number
  expressNo: string
  promoterId: string
  finderNickname: string
  commissionsRate: number
  commissionsAmount: number
  paymentStatus: number
}

export interface OrderPaymentStoreListParams {
  paymentId?: number
  promoterId?: string
  finderNickname?: string
  startDate?: string
  endDate?: string
  storeId?: number
  storeName?: string
}

export interface OrderPaymentStoreListModel {
  uuid?: string
  paymentId: number
  createdAt: string
  commissionsAmount: number
  storeId: number
  storeName: string
}

export interface OrderPaymentStorePromoterListModel {
  id: number
  promoterId: string
  finderNickname: string
  commissionsAmount: number
  promoterStatus: number
}

export interface ProductPromoteListParams {
  categoryId?: number //类目
  keyword?: string
  keywordType?: 1 | 2 | 3 // 1-商品名称；2-产品ID；3-商品编码
  lowPrice?: number //最低价
  upPrice?: number //最高价
  lowCommissionAmount?: number //最底佣金
  lowCommissionRate?: number //最低佣金比例
  productBrand?: number[] //品牌
  sortKey?: string //	 排序key；（佣金比例commissionsRate，价格groupPrice，销量salesNum）
  sortOrder?: string //	 销量排序（ascend-升序，descend-降序）
  storeId?: number
  storeName?: string
}

export interface ProductPromoteListModel {
  productId: string
  productType: number
  productTitle: string
  productShortName: string
  productSellingPoint: string
  productMainPic: string
  productBrand: number
  productBrandName: string
  groupPrice: number
  productStock: number
  productNo: string
  productNum: number
  storeId: number
  storeName: string
  productStatus: number
  examineStatus: number
  salesNum: number
  showSalesNum: number
  commissionsRate: number
  commissionsAmount: number
}
